package io.renren.modules.quickService.constants;

import java.util.HashMap;
import java.util.Map;

public enum AccountStatus {
    AVAILABLE("available", "正常"),
    NOT_AVAILABLE("not_available", "注销");
    private final String key;
    private final String value;

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    AccountStatus(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getValueByKey(String key) {
        AccountStatus[] enums = AccountStatus.values();
        for (final AccountStatus anEnum : enums) {
            if (anEnum.getKey().equals(key)) {
                return anEnum.getValue();
            }
        }
        return "";
    }


    /**
     * 转换为MAP集合	 * 	 * @returnMap<String, String>
     */
    public static Map<String, String> toMap() {
        Map<String, String> map = new HashMap<String, String>();
        AccountStatus[] enums = AccountStatus.values();
        for (final AccountStatus anEnum : enums) {
            map.put(anEnum.getKey(), anEnum.getValue());
        }
        return map;
    }
}
